package com.lbd.project.bean;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Transient;

import lombok.*;

import org.hibernate.annotations.DynamicUpdate;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.lbd.base.bean.AbstractEntity;

/**
 * Created by WangYajie on 2016/9/28.
 */

@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
@DynamicUpdate
@Entity
public class PersonalPaybackPlan extends AbstractEntity {
    public static final String PAYBACK_STATE_REPAYMENT = "0";//待还款
    public static final String PAYBACK_STATE_FINISH = "1";//已完成
    public static final String PAYBACK_STATE_OVERDUE = "2";//逾期
    public static final String PAYBACK_STATE_OVERDUE_FINISH = "3";//逾期已结清
    public static final String PAYBACK_STATE_NOT_DUE = "4";//未到期

    public PersonalPaybackPlan(String id, String qs, String name, String loginName, Date investDate, Date yhkr, Date hkrq, String state, BigDecimal paidBj, BigDecimal paidLx) {
        this.id = id;
        this.qs = qs;
        this.name = name;
        this.loginName = loginName;
        this.investDate = investDate;
        this.yhkr = yhkr;
        this.hkrq = hkrq;
        this.state = state;
        this.paidBj = paidBj;
        this.paidLx = paidLx;
    }

    private String num;//	编号
    private String qs;//	期数
    private BigDecimal bj;//	本金
    private BigDecimal lx;//    利息
    private BigDecimal paidBj;//	实收本金
    private BigDecimal paidLx;//	实收利息
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date yhkr;//	应还款日
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonInclude(JsonInclude.Include.ALWAYS)
    private Date hkrq;//还款日期
    private String orderId;//订单id
    private String state;//0.待还款1.已完成.2逾期3.逾期已结清4.未到期[前台展示叫未还款]
    //关联辅助字段,
    private String targetId;//标的id
    private String userId;//用户id
    private String paybackPlanId;//还款计划id


    //页面参数
    @Transient
    private String qsAll;//当前期数：期数/总期数
    @Transient
    private BigDecimal totalAmount;//应还总额=本金+利息
    @Transient
    private BigDecimal paidTotalAmount;//实际还款总额=实收本金+实收利息
    @Transient
    private String yqts;//逾期天数=还款日期-应还款日期
    @Transient
    private String loginName;//用户名
    @Transient
    private String name;//用户姓名
    @Transient
    private Date investDate;//投资时间


}
